/*** Replication code for generating the figures and tables in He and Song (2025) RFS: "Agency MBS as Safe Assets" ***/


   
     *** Figure 1 left panel: HQLA of Citigroup, JP Morgan, and Wells Fargo
clear
use LCR_format_December2021__HeSongRFS
graph bar fraction_1 fraction_2 fraction_3 fraction_4, over(id, sort(order) label(labsize(huge))) asyvars bar(1, fcolor(blue)) bar(2, fcolor(maroon))  bar(3, fcolor(forest_green)) bar(4, fcolor(dkorange)) legend(position(6) row(1) size(large) label(1 "Excess Reserves") label(2 "Treasurys") label(3 "Agency MBS")  label(4 "Others")) ytitle("Fraction (percent)", size(large) ) title("Composition of HQLA", size(large)) 
graph export HQLA_composition_December2021.pdf, replace	  
  
  
     *** Figure 1 right panel: repo volume summary statistics
clear
use Dec2021_Repo_Summary_HeSongRFS
graph bar fractoin_Tsy fractoin_AgencyMBS fractoin_AgencyDebt fractoin_other, asyvars bar(1, fcolor(maroon)) bar(2, fcolor(forest_green))  bar(3, fcolor(cyan)) bar(4, fcolor(dkorange))  legend(position(6) row(1) size(large)  label(1 "Treasurys") label(2 "Agency MBS") label(3 "Agency Debt")  label(4 "Others")) ytitle("Fraction (percent)", size(large)) title("Composition of Tri-party Repo", size(large)) 
graph export Repo_composition_Dec2021.pdf, replace	  

 
 
 
   *** Figure 2: time series of yield spreads and issuance amount  
use TimeSeriesSample_HeSongRFS
tsset dm

twoway (line spaaafnma30y_AjCDS dm, c(l) yaxis(1) lpattern("longdash"))  ///
       (line csaaa_AjCDS dm, c(l) yaxis(1) lpattern("shortdash_dot")) ///
	   (line fnma30yoas_AjCDS dm, c(l) yaxis(1) lpattern("solid")) ///
       , legend(position(6) row(1) size(large)  order(1 "AAA - FN30y" 2 "AAA - Treasury" 3 "Treasury - FN30y"))  title("Measures of Convenience Premium", size(large)) ytitle("basis point", axis(1) size(large))  xtitle("") xlabel(,labsize(large))
graph export TimeSeries_Plot_CovenienceYield_FNMA30y.pdf, replace	  

twoway (line Gross_Issu dm, c(l) yaxis(1) lpattern("solid"))  ///
       , legend(size(large) order(1 "FNMA 30y MBS"))  title("Monthly Issuance Amount of FN30y", size(large)) ytitle("\$ billion", axis(1) size(large))   xtitle("") xlabel(,labsize(large))
graph export TimeSeries_Plot_Issuance_FNMA30y.pdf, replace	  
	   
 

   *** Figure 3: time series of PMMS and FFR   
clear
use TimeSeriesSample_HeSongRFS
tsset dm
	 
twoway (line US30yrFRM dm, c(l) yaxis(1) lpattern("solid"))  ///
       , legend(position(6) row(1) size(large)  order(1 "30-year Primary Mortgage Rate"))  title("30-year Primary Mortgage Rate", size(large)) ytitle("percent", axis(1) size(large))  xtitle("")  xlabel(,labsize(large))   
graph export TimeSeries_Plot_PMMS.pdf, replace		

twoway (line Fed_funds_target dm, c(l) yaxis(1) lpattern("solid"))  ///
       , legend(position(6) row(1) size(large) order(1 "Federal Funds Rate Target"))  title("Federal Funds Rate Target", size(large)) ytitle("percent", axis(1) size(large))  xtitle("") xlabel(,labsize(large))
graph export TimeSeries_Plot_EFFR.pdf, replace	     
	   
	   
	   
	   
     *** Figure 4 Left panel: Policy shocks ---- Conservatorship 	
	      *On September 6, 2008, with the consent of both Fannie Mae's and Freddie Mac's (the Enterprises) board of directors, FHFA used its authorities to place each Enterprise into conservatorship.  
clear
use TimeSeriesSample_HeSongRFS
keep if (dm >= ym(2007,9) & dm<=ym(2009,9))
twoway (line fnma30yoas_AjCDS dm, c(l) yaxis(1) lpattern("solid"))  ///
       (line gn130yoas_AjCDS dm, c(l) yaxis(1) lpattern("dash")) ///
       , legend(ring(1) position(6) size(large) order(1 "Treasury-FN30y" 2 "Treasury-GN30y") row(1))  title("") ytitle("yield spread (basis point)", axis(1) size(large))  xtitle("") xlabel(,labsize(large)) tline(2008m9, lcolor(blue)) 	  
graph export TimeSeries_Plot_TsyMBS_Conservator.pdf, replace
 
 
     *** Figure 4 Right panel:  Policy shocks ----LCR	
clear
use TimeSeriesSample_HeSongRFS
keep if (dm >=ym(2012,12) & dm<=ym(2014,12))
twoway (line fnma30yoas_AjCDS dm, c(l) yaxis(1) lpattern("solid"))  ///
       (line gn130yoas_AjCDS dm, c(l) yaxis(1) lpattern("dash")) ///
       , legend(ring(1) position(6) size(large) order(1 "Treasury-FN30y" 2 "Treasury-GN30y") row(1))  title("") ytitle("yield spread (basis point)", axis(1) size(large))  xtitle("") xlabel(,labsize(large))  tline(2013m12, lcolor(blue)) 		
graph export TimeSeries_Plot_TsyMBS_LCR.pdf, replace
 
 
 
      *** Table 1: Summary statistics of yield spreads and issuance amount
clear
use TimeSeriesSample_HeSongRFS
set matsize 5000
outreg2 using summary_stat_CovenienceYield_FNMA30y, tex(frag) replace sum(detail) keep(fnma30yoas_AjCDS spaaafnma30y_AjCDS csaaa_AjCDS Gross_Issu) eqkeep(N mean sd min p25 p50 p75 max) excel dec(2) 


      *** Table 2: Regressions of Treasury-FN30y, AAA-FN30y, and and FN30y issuance amount on PMMS 
clear
use TimeSeriesSample_HeSongRFS
gen RuleThumbLag=0.75*_N^(1/3)
tsset dm	
ivreg2 fnma30yoas_AjCDS  US30yrFRM vix  logdebttogdp_fred logGSEtoGDP , bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM vix  logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(3) coefastr replace
ivreg2 spaaafnma30y_AjCDS US30yrFRM vix logdebttogdp_fred logGSEtoGDP , bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM vix  logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(3) coefastr append
ivreg2 Gross_Issu US30yrFRM vix logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM vix logdebttogdp_fred logGSEtoGDP)  stats(coef tstat) tex excel nolabel dec(3) coefastr append


      *** Table 3: Regressions of Treasury-FN30y, AAA-FN30y, and and FN30y issuance on FFR	
clear
use TimeSeriesSample_HeSongRFS
gen RuleThumbLag=0.75*_N^(1/3)
tsset dm	
ivreg2 US30yrFRM Fed_funds_target, bw(5) robust
outreg2 using reg_yieldspread, keep(Fed_funds_target) stats(coef tstat) tex excel nolabel dec(3) coefastr replace
ivreg2 fnma30yoas_AjCDS Fed_funds_target vix logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(Fed_funds_target vix logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(3) coefastr append
ivreg2 spaaafnma30y_AjCDS Fed_funds_target vix  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(Fed_funds_target vix logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(3) coefastr append
ivreg2 Gross_Issu Fed_funds_target vix logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(Fed_funds_target vix logdebttogdp_fred logGSEtoGDP)  stats(coef tstat) tex excel nolabel dec(3) coefastr append



   *** Table 4: Cross-sectional analysis of production coupons: FNMA30y Sample  
use CrossSectionalSample_HeSongRFS
   ** Panel A: summary statistics
sort IssuanceRank dm
gen dt= dofm(dm)
format dt %d
gen yyyy=year(dt)
gen mm=month(dt)
gen yyyymm=yyyy*100+mm
by IssuanceRank: egen dm_begin=min(yyyymm)
by IssuanceRank: egen dm_end=max(yyyymm)	 
set matsize 1000	
     * summary of data sample period for each coupon
estpost tabstat dm_begin, by(IssuanceRank) statistics(min) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2)) max(fmt(2))") replace   
estpost tabstat dm_end, by(IssuanceRank) statistics(min) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2)) max(fmt(2))") append   
     * summary of moneyness 
estpost tabstat moneyness, by(IssuanceRank) statistics(N mean sd p25 p50 p75) columns(statistics) listwise  
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(3)) sd(fmt(3))  min(fmt(3))  p25(fmt(3)) p50(fmt(3)) p75(fmt(3))  max(fmt(2))") append      
     * time series summary of gross new issuance, and AAA-MBS yield spread 	
estpost tabstat Gross_Issu, by(IssuanceRank) statistics(N mean sd p25 p50 p75) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(3)) sd(fmt(3))  min(fmt(3))  p25(fmt(3)) p50(fmt(3)) p75(fmt(3))  max(fmt(2))") append  
estpost tabstat spaaafnma30y_AjCDS, by(IssuanceRank) statistics(N mean sd p25 p50 p75) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2))  p25(fmt(2)) p50(fmt(2)) p75(fmt(2))  max(fmt(2))") append  
estpost tabstat TBAOASTsyBarclays_adjCDS, by(IssuanceRank) statistics(N mean sd p25 p50 p75) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2))  p25(fmt(2)) p50(fmt(2)) p75(fmt(2))  max(fmt(2))") append  
  
  ** Panel B: regression resutls
reg TBAOASTsyBarclays_adjCDS moneyness i.dm,  robust cluster(dm) 
outreg2 using Cross_section_result, keep(moneyness) stats(coef tstat)   tex excel nolabel dec(3)  addtext(Time FE, Yes) replace	
reg Gross_Issu moneyness i.dm, robust cluster(dm) 
outreg2 using Cross_section_result, keep(moneyness) stats(coef tstat)   tex excel nolabel dec(3)  addtext(Time FE, Yes) append	
reg TBAOASTsyBarclays_adjCDS moneyness i.dm if (IssuanceRank>=1 & IssuanceRank <=2),  robust cluster(dm) 
outreg2 using Cross_section_result, keep(moneyness) stats(coef tstat)   tex excel nolabel dec(3)  addtext(Time FE, Yes) append	
reg Gross_Issu moneyness i.dm if (IssuanceRank>=1 & IssuanceRank <=2), robust  cluster(dm) 
outreg2 using Cross_section_result, keep(moneyness) stats(coef tstat)   tex excel nolabel dec(3)  addtext(Time FE, Yes) append	
	
 
 
     *** Table 5: Regressions of the two policy shocks	   
clear
use TimeSeriesSample_HeSongRFS
gen PostConservator= (dm>=ym(2008,9))
gen PostLCR= (dm>ym(2013,12))
gen spreadfn30ygn130y=fnma30yoas_AjCDS-gn130yoas_AjCDS
tsset dm

ivreg2 fnma30yoas_AjCDS PostConservator US30yrFRM  vix logdebttogdp_fred logGSEtoGDP if (dm>=ym(2007,9) & dm<=ym(2009,9)), robust
outreg2 using reg_yieldspread, keep(PostConservator US30yrFRM vix logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr replace 
ivreg2 gn130yoas_AjCDS PostConservator  US30yrFRM  vix logdebttogdp_fred logGSEtoGDP  if (dm>=ym(2007,9) & dm<=ym(2009,9)), robust
outreg2 using reg_yieldspread, keep(PostConservator US30yrFRM vix logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append 
ivreg2 spreadfn30ygn130y PostConservator  US30yrFRM  vix logdebttogdp_fred logGSEtoGDP  if (dm>=ym(2007,9) & dm<=ym(2009,9)), robust
outreg2 using reg_yieldspread, keep(PostConservator US30yrFRM vix logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append 
 
ivreg2 fnma30yoas_AjCDS PostLCR  US30yrFRM  vix logdebttogdp_fred logGSEtoGDP if (dm>=ym(2012,12) & dm<=ym(2014,12)), robust
outreg2 using reg_yieldspread, keep(PostLCR US30yrFRM vix logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append 
ivreg2 gn130yoas_AjCDS PostLCR  US30yrFRM  vix logdebttogdp_fred logGSEtoGDP if (dm>=ym(2012,12) & dm<=ym(2014,12)), robust
outreg2 using reg_yieldspread, keep(PostLCR US30yrFRM vix logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append 
ivreg2 spreadfn30ygn130y PostLCR US30yrFRM  vix logdebttogdp_fred logGSEtoGDP  if (dm>=ym(2012,12) & dm<=ym(2014,12)), robust
outreg2 using reg_yieldspread, keep(PostLCR US30yrFRM vix logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append 
 
ivreg2 gn130yoas_AjCDS US30yrFRM vix logdebttogdp_fred logGSEtoGDP if dm>=ym(2003,10), bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM vix  logdebttogdp_fred logGSEtoGDP)  stats(coef tstat) tex excel nolabel dec(2) coefastr append

	
	
	
	*** Table 6: dealer forcast dispersion 
clear 
use CrossSectionalSample_HeSongRFS
sort dm IssuanceRank
drop if DispersionDealerCPRLevel==.
 
      ** Panel A: summary statistics
sort IssuanceRank dm
gen dt= dofm(dm)
format dt %d
gen yyyy=year(dt)
gen mm=month(dt)
gen yyyymm=yyyy*100+mm
by IssuanceRank: egen dm_begin=min(yyyymm)
by IssuanceRank: egen dm_end=max(yyyymm)	 
set matsize 1000	
     * summary of data sample period for each coupon
estpost tabstat dm_begin, by(IssuanceRank) statistics(min) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2)) max(fmt(2))") replace   
estpost tabstat dm_end, by(IssuanceRank) statistics(min) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2)) max(fmt(2))") append   
     * summary of moneyness 
estpost tabstat moneyness, by(IssuanceRank) statistics(N mean sd p25 p50 p75) columns(statistics) listwise  
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(3)) sd(fmt(3))  min(fmt(3))  p25(fmt(3)) p50(fmt(3)) p75(fmt(3))  max(fmt(2))") append      
     * time series summary of gross new issuance, and AAA-MBS yield spread 	
estpost tabstat Gross_Issu, by(IssuanceRank) statistics(N mean sd p25 p50 p75) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(3)) sd(fmt(3))  min(fmt(3))  p25(fmt(3)) p50(fmt(3)) p75(fmt(3))  max(fmt(2))") append  
estpost tabstat TBAOASTsyBarclays_adjCDS, by(IssuanceRank) statistics(N mean sd p25 p50 p75) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2))  p25(fmt(2)) p50(fmt(2)) p75(fmt(2))  max(fmt(2))") append  
estpost tabstat spaaafnma30y_AjCDS, by(IssuanceRank) statistics(N mean sd p25 p50 p75) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2))  p25(fmt(2)) p50(fmt(2)) p75(fmt(2))  max(fmt(2))") append  
estpost tabstat DispersionDealerCPRLevel, by(IssuanceRank) statistics(N mean sd p25 p50 p75) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2))  p25(fmt(2)) p50(fmt(2)) p75(fmt(2))  max(fmt(2))") append  

     ** Panel B: regression resutls
reg DispersionDealerCPRLevel cp i.dm, robust cluster(dm) 
outreg2 using Cross_section_result, keep(cp) stats(coef tstat)   tex excel nolabel dec(3)  addtext(Time FE, Yes) replace	
reg Gross_Issu DispersionDealerCPRLevel i.dm, robust cluster(dm) 
outreg2 using Cross_section_result, keep(DispersionDealerCPRLevel) stats(coef tstat)   tex excel nolabel dec(3)  addtext(Time FE, Yes) append	
reg TBAOASTsyBarclays_adjCDS DispersionDealerCPRLevel i.dm,  robust cluster(dm) 
outreg2 using Cross_section_result, keep(DispersionDealerCPRLevel) stats(coef tstat)   tex excel nolabel dec(3)  addtext(Time FE, Yes) append	
reg TBAOASTsyBarclays_adjCDS DispersionDealerCPRLevel cp i.dm,  robust cluster(dm) 
outreg2 using Cross_section_result, keep(cp DispersionDealerCPRLevel) stats(coef tstat)   tex excel nolabel dec(3)  addtext(Time FE, Yes) append	


	
	
	   
	   *** Table 7: Seasoned coupons:  FNMA30y   
clear
use SeasonedCohortSample_HeSongRFS
sort dm cp

	** Panel A: summary statistics of seasoned MBS
sort cp dm	
gen dt= dofm(dm)
format dt %d
gen yyyy=year(dt)
gen mm=month(dt)
gen yyyymm=yyyy*100+mm
by cp: egen dm_begin=min(yyyymm)
by cp: egen dm_end=max(yyyymm)	 
set matsize 1000	
     * summary of data sample period for each coupon
estpost tabstat dm_begin, by(cp) statistics(min) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2)) max(fmt(2))") replace   
estpost tabstat dm_end, by(cp) statistics(min) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2)) max(fmt(2))") append   
     * summary of moneyness 
estpost tabstat moneyness, by(cp) statistics(N mean sd p25 p50 p75) columns(statistics) listwise  
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(3)) sd(fmt(3))  min(fmt(3))  p25(fmt(3)) p50(fmt(3)) p75(fmt(3))  max(fmt(2))") append      
     * time series summary of AAA-MBS yield spread 	
estpost tabstat spaaafnma30y_AjCDS, by(cp) statistics(N mean sd p25 p50 p75) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2))  p25(fmt(2)) p50(fmt(2)) p75(fmt(2))  max(fmt(2))") append  
estpost tabstat TBAOASTsyBarclays_adjCDS, by(cp) statistics(N mean sd p25 p50 p75) columns(statistics) listwise 
esttab using mbs_sumstat_sample.tex, cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2))  min(fmt(2))  p25(fmt(2)) p50(fmt(2)) p75(fmt(2))  max(fmt(2))") append  
	
   ** Panel B: regression results  
reg spaaafnma30y_AjCDS moneyness vix  logdebttogdp_fred   i.cp_dummy,  robust cluster(dm) 
outreg2 using Seasoned_result, keep(moneyness vix logdebttogdp_fred) stats(coef tstat)   tex excel nolabel dec(3)  addtext(Coupon FE, Yes) replace	
reg TBAOASTsyBarclays_adjCDS  moneyness vix logdebttogdp_fred   i.cp_dummy,  robust cluster(dm) 
outreg2 using Seasoned_result, keep(moneyness vix logdebttogdp_fred) stats(coef tstat)   tex excel nolabel dec(3)  addtext(Coupon FE, Yes) append	

	
	
	
		
	
	*** Table 8: Summary of investors' Holdings of Treasury and Agency MBS
clear 
use AssetHoldingsSample_HeSongRFS.dta
tsset YYYYQQ

outreg2 using Summary_MBSHoldings, tex(frag) replace sum(detail) ///
              keep(TsyHold_GSE TsyHold_USDIs TsyHold_CU TsyHold_MMF  TsyHold_LifeInsurance TsyHold_MF TsyHold_PCInsurance TsyHold_PrivatePF TsyHold_StateLocalGov TsyHold_StateLocalPF TsyHold_RoW Tsy_TotalOutstanding) eqkeep(N mean sd min p25 p50 p75 max) excel dec(0) 
				   
outreg2 using Summary_MBSHoldings, tex(frag) replace sum(detail) ///
              keep(AgencyMBSHold_GSE AgencyMBSHold_USDIs AgencyMBSHold_CU AgencyMBSHold_MMF AgencyMBSHold_LifeInsurance AgencyMBSHold_MF AgencyMBSHold_PCInsurance  AgencyMBSHold_PrivatePF AgencyMBSHold_StateLocalGov AgencyMBSHold_StateLocalPF AgencyMBSHold_RoW AgencyMBS_TotalOutstanding) eqkeep(N mean sd min p25 p50 p75 max) excel dec(0) 
				   	   
outreg2 using Summary_MBSHoldings, tex(frag) replace sum(detail) ///
              Keep(MBS2Tsy_GSE MBS2Tsy_USDIs MBS2Tsy_CU MBS2Tsy_MMF MBS2Tsy_LifeInsurance MBS2Tsy_MF MBS2Tsy_PCInsurance MBS2Tsy_PrivatePF MBS2Tsy_StateLocalGov MBS2Tsy_StateLocalPF MBS2Tsy_RoW MBS2Tsy_Total) eqkeep(N mean sd min p25 p50 p75 max) excel dec(2) 
				
				
				
	*** Table 9: Regression of investors' holdings on PMMS 
clear 
use AssetHoldingsSample_HeSongRFS.dta
tsset YYYYQQ
gen RuleThumbLag=0.75*_N^(1/3)
		
     /*  use PMMS */
ivreg2 MBS2Tsy_GSE US30yrFRM  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr replace	
ivreg2 MBS2Tsy_USDIs US30yrFRM  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append	
ivreg2 MBS2Tsy_CU US30yrFRM  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append	
ivreg2 MBS2Tsy_MMF US30yrFRM  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append	
ivreg2 MBS2Tsy_LifeInsurance US30yrFRM  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append	
ivreg2 MBS2Tsy_MF US30yrFRM  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append	
ivreg2 MBS2Tsy_PCInsurance US30yrFRM  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append	
ivreg2 MBS2Tsy_PrivatePF US30yrFRM  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(4) coefastr append	
ivreg2 MBS2Tsy_StateLocalGov US30yrFRM  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append	
ivreg2 MBS2Tsy_StateLocalPF US30yrFRM  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append	
ivreg2 MBS2Tsy_RoW US30yrFRM  logdebttogdp_fred logGSEtoGDP, bw(5) robust
outreg2 using reg_yieldspread, keep(US30yrFRM logdebttogdp_fred logGSEtoGDP) stats(coef tstat) tex excel nolabel dec(2) coefastr append	


 
 
 
